package com.uh.calculation.operator;

import com.uh.calculation.bean.OperatorVal;
import com.uh.calculation.bean.WarnJiSuanBean;
import com.uh.calculation.util.GetFileds;
import com.uh.microservice.core.dao.JdbcDao;
import lombok.Data;

import java.util.List;
import java.util.Map;

//import com.uh.calculation.util.GetFileds;

@Data
/**
 * 同比环比增长算子(单字段变更)
 */
public class PpMaoyiOperator {
    private JdbcDao jdbcDao;
    private WarnJiSuanBean warnJiSuanBean;

    /**
     * 计算统计人员预警因子
     */
    public Integer jisuan(List<OperatorVal> list, WarnJiSuanBean warnJiSuanBean) {
        this.warnJiSuanBean = warnJiSuanBean;
        GetFileds getFileds = new GetFileds(jdbcDao, list, warnJiSuanBean);
        String surveyobjectid = warnJiSuanBean.getSurveyobjectid();

        Integer year = warnJiSuanBean.getYear();
        Integer num = 0;
        for (OperatorVal operatorVal : list) {
            String field = operatorVal.getField();
            String str[] = field.split("_");
            String t = str[0];
            String tab = t + "_" + year;
            String mf = str[1];
            String sql = "select  * from  %s  where  SURVEYOBJECTID = %s  ORDER BY  time_code asc";
            String q = String.format(sql, t, surveyobjectid);
            List<Map<String, Object>> ls = jdbcDao.loadList(q);
            /** 未比较lasttime */

        }
        return null;
    }

}